package org.goldenport.g3.app

import org.goldenport.g3._
import org.goldenport.g3.atom._
import org.goldenport.g3.messages._
import org.goldenport.g3.channels.dropbox._

/**
 * @since   Sep. 25, 2010
 * @version Sep. 25, 2010
 * @author  ASAMI, Tomoharu
 */
class AtomDropboxCli extends G3Application with DropboxContext {
  val url = "http://twitter.com/statuses/public_timeline.atom"

  service('feed, url)
  dropbox('db)

  start invoke("feed") agent {
    case AtomFeed(feed) => {
      Post("/g3/atom.csv",
           feed.toRecordSet(entry => {
             Record('id -> entry.id,
                    'title -> entry.title,
                    'date -> entry.updated,
                    'content -> entry.contentText)
           }))
    }
  } invoke("db")
}
